//
//  FillRuleView.m
//  test02
//
//  Created by lzh on 2020/10/24.
//  Copyright © 2020 NO. All rights reserved.
//

#import "FillRuleView.h"

@implementation FillRuleView


-(void)drawRect:(CGRect)rect{
    
    CAShapeLayer * shape_Layer = [CAShapeLayer layer];
    
    UIBezierPath * path1 = [UIBezierPath bezierPathWithRect:rect];
    UIBezierPath * path = [UIBezierPath bezierPath];
    
    [path moveToPoint:CGPointMake(50, 50)];
    [path addLineToPoint:CGPointMake(50, 150)];
    [path addLineToPoint:CGPointMake(150, 150)];
    [path addLineToPoint:CGPointMake(150, 50)];
    [path closePath];
    
    [path1 appendPath:path];
    
    shape_Layer.lineWidth = 2.0;
    shape_Layer.fillColor = [UIColor redColor].CGColor;
    shape_Layer.path = path1.CGPath;
    shape_Layer.fillRule = kCAFillRuleEvenOdd;
    
    [self.layer addSublayer:shape_Layer];
}

@end
